from common.base import Base
from common.base import open_browser

import time
url = "http://ecshop.itsoso.cn/user.php"


class ListPage(Base):
    """封装定位器"""
    locator_country = ("id","selCountries_0")
    locator_province = ("id","selProvinces_0")
    locator_city = ("id","selCities_0")
    locator_district = ("id","selDistricts_0")
    locator_name = ("name","consignee")
    locator_email = ("name","email")
    locator_address = ("name","address")
    locator_zipcode = ("name","zipcode")
    locator_tel = ("name","tel")
    locator_mobile = ("name","mobile")
    locator_submit = ("name","submit")
    locator_user = ("link text","用户中心")
    locator_logout = ("link text","退出")
    locator_home = ("link text","首页")
    locator_delete = ("name","button")
    locator_add = ("link text","收货地址")




    def slect_country(self):
        #定位国家下拉框
        self.random_choice_select(self.locator_country)

    def slect_province(self):
        #定位省份下拉框
        self.random_choice_select(self.locator_province)

    def slect_city(self):
        #定位城市下拉框
        self.random_choice_select(self.locator_city)

    def slect_district(self):
        #定位县级下拉框
        self.random_choice_select(self.locator_district)

    def input_name(self,name):
        #定位收货人姓名
        self.send_keys(self.locator_name,name,10)

    def input_email(self,email):
        #定位电子邮件地址
        self.send_keys(self.locator_email,email,10)

    def input_address(self,address):#
        #详细地址
        self.send_keys(self.locator_address,address,10)

    def input_zipcode(self,zipcode):
        #邮编
        self.send_keys(self.locator_zipcode,zipcode,10)

    def input_tel(self,tel):
        #电话
        self.send_keys(self.locator_tel,tel,10)

    def input_mobile(self,mobile):
        #手机
        self.send_keys(self.locator_mobile,mobile,10)

    def click_submit(self):
        #点击保存
        self.click(self.locator_submit,10)

    def click_user(self):
        #点击用户中心
        self.click(self.locator_user,10)

    def click_logout(self):
        #点击退出
        self.click(self.locator_logout,10)

    def click_home(self):
        #点击首页
        self.click(self.locator_home,10)

    def click_add(self):
        #点击收货地址
        self.click(self.locator_add,10)

    def click_delete(self):
        #点击删除
        self.click(self.locator_delete,10)

    def click_aletor(self):
        #进入弹窗点击确定
        self.alert_out()

if __name__ == '__main__':
    pass